import apis from '../../http/apis/apis';
export default {
    namespaced: true,
    state: {
        claims: []
    },
    mutations: {
        setClaims(state, data) {
            state.claims = data
        },
    },
    actions: {
        //add
        async addClaims({ commit, state }, claim) {
            const data = await apis.claims.addClaims(claim)
            if (data.status) {
                console.log(data);
            }
        },
        //get
        async getClaims({ commit, state }) {
            const data = await apis.claims.getClaims()
            if (data.status) {
                console.log(data);
                commit('setClaims', data.data)
            }
        },

        //update
        async editClaims({ commit, state }, claim) {
            const data = await apis.claims.editClaims(claim)
            if (data.status) {
                console.log('修改成功');
            } else {
                console.log('修改失败');
            }
        },

        //delete
        async deleteClaims({ commit, state }, claim) {
            return await apis.claims.deleteClaims(claim);

        },
    }
}